package com.eagle.scali.contentcenter.controller;


import com.eagle.scali.commoncenter.auth.CheckAuthorization;
import com.eagle.scali.commoncenter.auth.CheckLogin;
import com.eagle.scali.commoncenter.util.JwtOperator;
import com.eagle.scali.contentcenter.domain.dto.content.ShareAuditDTO;
import com.eagle.scali.contentcenter.domain.entity.content.Share;
import com.eagle.scali.contentcenter.service.content.ShareService;
import com.github.pagehelper.PageInfo;
import io.jsonwebtoken.Claims;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/admin/shares")
@ComponentScan(basePackages = { "com.eagle.scali.commoncenter"})
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ShareAdminController {
    private final ShareService shareService;

	private final JwtOperator jwtOperator;

	/**
	 * 手动审批投稿,id是share的id,不是userid
	 *
	 * X-Token:eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTAwMDAsInd4Tmlja25hbWUiOiLlrqHmibnnlKjmiLciLCJyb2xlIjoiYXBwcm92ZXIiLCJpYXQiOjE1ODY2MTU5OTksImV4cCI6MTU4NzgyNTU5OX0.7d1Bdaue6cuD1FGw9hyAvWZ8sLW0THTpeK_RR6EMe1E
	 * @param id
	 * @param auditDTO
	 * @return
	 */
    @PutMapping("/audit/{id}")
    @CheckAuthorization("approver")
    public Share auditById(@PathVariable Integer id, @RequestBody ShareAuditDTO auditDTO) {
        return this.shareService.auditById(id, auditDTO);
	}




}
